package com.exampleyyy.demoyyy.controller;

import com.alipay.api.AlipayApiException;
import com.exampleyyy.demoyyy.JieKouService.AliPayServiceJieKou;
import com.exampleyyy.demoyyy.JieKouService.OrderServiceJieKou;
import com.exampleyyy.demoyyy.SHITIYYY.Orders;
import com.exampleyyy.demoyyy.SHITIYYY.Zhifubao;
import com.exampleyyy.demoyyy.common.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 订单
 */
@Slf4j
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderServiceJieKou orderservicejiekou;
    @Autowired
    private AliPayServiceJieKou alipayservicejiekou;

    @PostMapping("/submit")
    public  R<Object> submitorder(@RequestBody Orders orders){
        log.info("订单数据：{}",orders);
        if (orderservicejiekou.submit(orders)==1){
            return R.success(1,"订单提交成功",null);
        }else{
            return R.success(0,"订单提交失败",null);
        }

    }
}